package com.fenghuajueli.module_host;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.fenghuajueli.libbasecoreui.adapter.DefaultViewPagerAdapter;
import com.fenghuajueli.libbasecoreui.mvp.BaseActivity;
import com.fenghuajueli.libbasecoreui.utils.MyStatusBarUtils;
import com.fenghuajueli.module_host.databinding.ActivityMainBinding;
import com.fenghuajueli.module_route.CommonRoute;
import com.fenghuajueli.module_route.HomeModuleRoute;
import com.fenghuajueli.module_route.UserModuleRoute;

import java.util.ArrayList;
import java.util.List;

@Route(path = CommonRoute.COMMON_MAIN)
public class MainActivity extends BaseActivity {

    ActivityMainBinding binding;

    private Fragment homeFragment;
    private Fragment mineFragment;

    private List<Fragment> fragmentList;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        MyStatusBarUtils.setStatusBar(this, "#00000000");
        homeFragment = (Fragment) ARouter.getInstance().build(HomeModuleRoute.HOME_PAGE).navigation();
        mineFragment = (Fragment) ARouter.getInstance().build(HomeModuleRoute.MINE_PAGE).navigation();
        fragmentList = new ArrayList<>();
        fragmentList.add(homeFragment);
        fragmentList.add(mineFragment);
        DefaultViewPagerAdapter adapter = new DefaultViewPagerAdapter(getSupportFragmentManager(), fragmentList);
        binding.viewPager.setAdapter(adapter);
        binding.bbl.setViewPager(binding.viewPager);


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        binding = null;
    }
}